import java.util.Scanner;
public class test421 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("Enter a SSN: ");
        String ssn = scanner.nextLine();
        boolean isValid = false;
        if (ssn.length() == 11) {
            if (ssn.charAt(3) == '-' && ssn.charAt(6) == '-') {
                String part1 = ssn.substring(0, 3);
                String part2 = ssn.substring(4, 6);
                String part3 = ssn.substring(7, 11);
                if (part1.matches("\\d+") && part2.matches("\\d+") && part3.matches("\\d+")) {
                    isValid = true;
                }
            }
        }
        if (isValid) {
            System.out.println(ssn + " is a valid social security number");
        } else {
            System.out.println(ssn + " is an invalid social security number");
        }
        scanner.close();
    }
}

